package com.yutel.multher.jas;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

public class JasContext {
	public static final String JAS_CONFIG_PATH = "conf";
	public static final String JAS_LIB_PATH = "libs";
	static final String JAS_CONFIG_KEY = "jas.config";
	static final String JAS_CONFIG_FILE = "launcher.properties";
	static final String LAUNCHER_HOME = "launcher.home";
	static final String APPLICATION_HOME = "application.home";

	private Properties properties = new Properties();

	public JasContext() {
	}

	public String getProperty(String name) {
		return properties.getProperty(name);
	}

	/**
	 * Return specified property value.
	 */
	public String getProperty(String name, String defaultValue) {
		return properties.getProperty(name, defaultValue);
	}

	/**
	 * @param name
	 * @param value
	 */
	public void setProperty(String name, String value) {
		properties.setProperty(name, value);
	}

	/**
	 * Load properties.
	 * 
	 * @throws IOException
	 */
	public void loadProperties(InputStream is) throws IOException {
		if (is != null) {
			properties.load(is);
		}
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.lang.Object#toString()
	 */
	@Override
	public String toString() {
		return "Configuration {properties=" + properties + "}";
	}

}
